use std::mem::size_of;
static B: [u8; 10] = [99, 2, 3, 4, 4, 4, 4, 44, 4, 90];
static C: [u8; 11] = [99, 2, 3, 4, 4, 4, 4, 44, 4, 190, 0];
fn main() {
    let a: usize = 42; //编译目标，取决于cpu
    let b: &[u8; 10] = &B;
    let c: Box<[u8]> = Box::new(C); //将某值放入box后，所有权转移给box的所有者。
    println!("a (an unsigned integer):");
    println!("   location:{:p}", &a);
    println!("   size:       {:?} bytes", size_of::<usize>());
    println!("   value:      {:?}", a);
    println!();

    println!("b (a reference to B):");
    println!("   location:{:p}", &b);
    println!("   size:       {:?} bytes", size_of::<&[u8; 10]>());
    println!("   value:      {:?}", b);
    println!();

    println!("c (a \"box\" for C):");
    println!("   location:{:p}", &c);
    println!("   size:       {:?} bytes", size_of::<Box<[u8]>>());
    println!("   value:      {:?}", c);
    println!();

    println!("B (an array of 10 bytes):");
    println!("   location:{:p}", &B);
    println!("   size:       {:?} bytes", size_of::<[u8; 10]>());
    println!("   value:      {:?}", B);
    println!();

    println!("C (an array of 11 bytes):");
    println!("   location:{:p}", &C);
    println!("   size:       {:?} bytes", size_of::<[u8; 11]>());
    println!("   value:      {:?}", C);
    println!();
}
